#include "task_ShowTime.h"
#include "FreeRTOS.h"
#include "task.h"


static DateTime dateTime = {0,0,0,0,0,0};

DateTime* task_ShowTime_GetCurrentDateTime()
{
    ++dateTime.second;
	if (60 == dateTime.second) {
		dateTime.second = 0;
		++dateTime.minute;
		if(60 == dateTime.minute){
			dateTime.minute = 0;
			++dateTime.hour;
			if(24 == dateTime.hour){
				dateTime.minute = 0;
			}
		}
	}
	
	TickType_t tickCount = xTaskGetTickCount();
	vTaskDelayUntil(&tickCount, pdMS_TO_TICKS(1000));  // 1m
	
	return &dateTime;
}

DateTime* task_ShowTime_GetDefaultDateTime()
{
	return &dateTime;
}
